package com.tyut.mapper;

import com.github.pagehelper.Page;
import com.tyut.pojo.Article;
import com.tyut.pojo.Category;
import com.tyut.pojo.Editor;
import com.tyut.pojo.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface EditorMapper {
	Page<Article> list(Integer categoryId, String state, String checkState);
	@Select("select * from category")
	List<Category> find();
	@Select("select * from editor where username = #{name} and state = 0")
	User findByName(String username);
	@Update("update editor set user_pic=#{userPic},update_time=#{updateTime} where id=#{id}")
	void updateAvatar(Editor editor);
	@Update("update editor set nickname=#{nickname},email=#{email},update_time=#{updateTime} where id=#{id}")
	void update(Editor editor);
	@Update("update editor set password=#{password},update_time=#{updateTime} where id=#{id}")
	void updatePwd(Editor editor);

	Page<Editor> editorlist(String username);
	@Update("update editor set state = #{state} where id = #{id}")
	void updateState(Integer id, String state);
	@Delete("delete from editor where id = #{id}")
	void delete(Integer id);
}
